
<template>
    <div>
        <article v-html="markdown"></article>
    </div>


</template>

<script>
import MarkdownIt from 'markdown-it'
export default {
    components:{
        MarkdownIt
    },
    mounted() {
    },
    data: function () {
        return {
            blogId:'',
            blog:{
                context:'加载中...'
            },
            toolbars: {
                readmodel: true,
                subfield: false, 
            },
        }
    },
    methods: {
        LoadMD(){
            this.$axios.get("/article/get",{params:{articleId:this.blogId}}).then(res => {
                if (res) {
                    this.blog = res.data.data;
                    //console.log(this.blog.context)
                }
                else {
                    this.$message.error("加载失败");
                }
            });
        }
        
    },
    computed:{
        markdown(){
            const md = new MarkdownIt();
            debugger;
            const result = md.render(this.blog.context)
            debugger;
            return result;
        }
    }, created() {
        this.blogId = this.$route.params.id;
        this.LoadMD();
    }
}
</script>


<style scoped>

</style>

